<?php
function smarty_modifier_cut($string, $length = 80, $etc = "..."){
	if (strlen($string) <= $length ){ 
		return $string; 
	}else{ 
		$i = 0; 
		while ($i < $length){ 
			$stringtmp = substr($string,$i,1); 
			if ( ord($stringtmp) >=224 ){ 
				$stringtmp = substr($string,$i,3); 
				$i = $i + 3; 
			}elseif( ord($stringtmp) >=192 ){ 
				$stringtmp = substr($string,$i,2); 
				$i = $i + 2; 
			}else{ 
				$i = $i + 1; 
			} 
			$stringlast[] = $stringtmp; 
		} 
		$stringlast = implode("",$stringlast); 
		if($etc){$stringlast .= $etc;} 
		return $stringlast; 
	} 
}
?>

